﻿<!--#include file="../inc/common.asp" -->
<!--#include file="skin_templet.asp" -->
<%
    if not userRightObj.canManage then
        message("您没有设置权限")
    end if
    
    dim url, pageSize, totalCount, i
    
    url = "select_templet.asp?blog_id=" & blogObj.blogId
    call OpenDB
%>
<HTML><HEAD><TITLE><%=blogObj.blogTitle%>—控制面板—选择模板</TITLE>

<link rel="stylesheet" href="<%=cssFile%>" type="text/css" />
<style type="text/css">
td{
    font-size:10pt;
}
</style>
<script language=javascript>
    function templetSelected(){
        theform = document.getElementById("form1");
        theform.actionType.value="templet_selected";
        theform.submit();
    }
    function previewTemplet(){

        theform = document.getElementById("form1");
        theform.actionType.value="preview_templet";
        
        tmp=theform.target;
        theform.target = "preview";
        theform.submit();
        theform.target = tmp;
    }
        
    function exit(){
        theform = document.getElementById("form1");
        theform.actionType.value="";
        theform.submit();
    }    
</script>
</head>
<body bgcolor="#c1c1c1" leftmargin="0" topmargin="0" style="font-size:10pt">
<div style="width:830px;height:100%;">

<div style="float:left;width: 160px; padding-top:20px">
<!--#include file="menu.asp" -->
</div>

<div style="background:#ffffff; width:650px; height:100%;float:left;padding:20px 10px 10px 10px">
<form name=form1  id=form1 action=templet.asp method=post>
<input type=hidden name=blog_id value="<%=blogObj.blogId%>">
<input type=hidden name=actionType value="">
<input type=radio name="parent_id" value="-1" checked>空白模板
<div align=center>
<input type=button name="preview_templet" value=" 预览 " onclick="previewTemplet()">
<input type=button name="templet_selected" value="下一步" onclick="templetSelected()">
<input type=button name="cancel" value=" 取消 " onclick="exit()">
</div> 
<p><i>您可以在以下模板基础上创建自己的模板</i>：</p>
<p><b>系统预设模板</b>：</p>
<%
call writeSysTemplets(True) ' skin_templet.asp
%>
<p align=center>
<input type=button name="preview_templet" value=" 预览 " onclick="previewTemplet()">
<input type=button name="templet_selected" value="下一步" onclick="templetSelected()">
<input type=button name="cancel" value=" 取消 " onclick="exit()">
</p> 
<p><b>您创建的模板</b>：</p>
<table  border=1 cellspacing=0  style="border-collapse: collapse" bordercolor="gray">
  <tr>
    <td>选择</td><td>模板名</td><td>描述</td><td>创建日期</td><td>&nbsp;</td><td>&nbsp;</td>
  </tr>
<%
    sql = " select * from blog_template where blog_id=" & blogObj.blogId
    rs.open sql, conn, 1, 1
    while not rs.eof
%>  
  <tr>
    <td><input type=radio name="parent_id" value="<%=rs("template_id")%>"></td>
    <td nowrap><%=rs("template_name")%>&nbsp;</td>
    <td><%=rs("template_desc")%>&nbsp;</td>
    <td nowrap><%=rs("insert_time")%></td>
    <td><% if rs("is_default")=true then response.write("当前模板") end if%>&nbsp;</td>
    <td><% if rs("is_published")=true then response.write("已公开") end if%>&nbsp;</td>
  </tr>
<%
        rs.moveNext()
    wend    
    rs.close()
%>  
</table>    
<p align=center>
<input type=button name="preview_templet" value=" 预览 " onclick="previewTemplet()">
<input type=button name="templet_selected" value="下一步" onclick="templetSelected()">
<input type=button name="cancel" value=" 取消 " onclick="exit()">
</p>   
<p><b>其他用户共享的模板</b>：</p>
<a name="#pageno_share"></a>
<table  border=1 cellspacing=0  style="border-collapse: collapse" bordercolor="gray">
  <tr>
    <td>选择</td><td>模板名</td><td>描述</td><td>创建人</td><td>创建日期</td>
  </tr>
<%
	dim pageno_share
	pageno_share = request("pageno_share")
	pageSize = 10
	i = 0
    sql = " select * from blog_template where is_published=true and blog_id<>" & blogObj.blogId 
    rs.open sql, conn, 1, 1

    totalCount = rs.recordCount
    if not rs.eof then
    	if pageno_share<>"" then
    	   rs.pageSize = pageSize
           rs.absolutePage=pageno_share
           
    	end if
	end if
    while not rs.eof and i<pageSize 
%>  
  <tr>
    <td><input type=radio  name="parent_id" value="<%=rs("template_id")%>"></td>
    <td nowrap><%=rs("template_name")%>&nbsp;</td>
    <td><%=rs("template_desc")%>&nbsp;</td>
    <td><%=rs("user_name")%>&nbsp;</td>
    <td nowrap><%=rs("insert_time")%> </td>
  </tr>
<%
        rs.moveNext()
        i=i+1
    wend    
    rs.close()
%>  
</table>    
<div align=center>
  <%=htmlPageLink2(pageno_share, pageSize, totalCount , url, "pageno_share")%>
</div>  


<p align=center>
<input type=button name="preview_templet" value=" 预览 " onclick="previewTemplet()">
<input type=button name="templet_selected" value="下一步" onclick="templetSelected()">
<input type=button name="cancel" value=" 取消 " onclick="exit()">
</p>    
</div>
</body>    
</html>    
<!--#include file="../inc/end.asp" -->
